<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "cargo");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/index.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/cntable.jsp"%>
<style type="text/css">
	.panel{margin-bottom:0px;}
	body{
		padding:10px 0px 0px 0px !important;
		overflow: hidden;
	}
</style>
<div id="cargo" class="col-md-7 col-sm-7" style="border-right:1px solid #ddd;padding-right: 0px;">
	<t:form modelAttribute="cargoSearch" cssClass="form-horizontal" method="post" action="/cargo/cargo/index" ajaxPost="true" onSuccess="onSuccess">
		<c:import url="seniorSearch.jsp" />
		<t:panel cssClass="panel-flat border-primary border-top-xlg" customBody="true" customHead="true">	
			<t:panelHead title="货品管理"></t:panelHead>
			<div class="panel-body">
				<div class="row">
					<c:import url="input.jsp" />
				</div>
				<div id="tableContent" class="row" style="overflow:auto;">
					<c:import url="output.jsp" />
				</div>
			</div>			
		</t:panel>
	</t:form>
</div>

<div class="col-md-5 col-sm-5" style="padding-left: 0px;">
       <iframe scrolling="auto" frameborder="0" scrolling="yes" width="100%" height="100%" id="collocationIframe" name="collocationIframe" data-url="<c:url value='/cargo/collocation/index' />" src=""></iframe>
</div>
	
<script type="text/javascript">

$(function(){
	resizeEx();
	$(window).resizeend({delay : 500}, function() {
		resizeEx();
	});
	renderTableClick();
});
window.onload=function (){
	pictureLoad();
}
function pictureLoad(){
	$("img[name='pictureLoad']").each(function(){
	    var url=$(this).data("url");
	    $(this).attr("src",url);
	});
}
function resizeEx(){
	$("#tableContent").height($(window).height()-207);
	$(".panel-body").height($(window).height()-175)
	$("#collocationIframe").height($(window).height()-18);
}

function renderTableClick(){
	$(".cntable.table tbody tr").on("click",function(){
		var cargoId=$(this).attr("data-id");
		var url=$("#collocationIframe").data("url");
		url+="?cargoId="+cargoId;
		$("#collocationIframe").attr("src",url);
	});
	$(".cntable.table tbody tr:first").click().addClass("select-tr");
	 
}

function onSuccess(res){
	$("#tableContent").html(res);
	
	redrawTable();
	
	renderTableClick();
	pictureLoad();
}

function searchCallback(){
	formSubmit();
}
function pagerChangeCallback(){
	formSubmit();
}
function sortingCallback(){
	formSubmit();
}
function formSubmit(){
	$("form:first").submit();	
}
</script>


<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared//master/contentFooter.jsp"%>